package com.javaclimb.controller;

import com.javaclimb.pojo.AnalyseData;
import com.javaclimb.service.AnalyseDataService;
import com.javaclimb.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j //用于记录日志
@RestController
@RequestMapping("/analyse")//共同路径
public class AnalyseDataController {
    @Autowired
    private AnalyseDataService analyseDataService;

    @RequestMapping("/CityTreeCount")
    public Result getCityTreeCount(){
        List<AnalyseData> ctc= analyseDataService.getCityTreeCount();
        //log.info("获取城市古树数量:"+ctc);
        return Result.success(ctc);
    }
    @RequestMapping("/LevelCount")
    public Result getLevelCount(){
        log.info("获取等级统计");
        return Result.success(analyseDataService.getLevelCount());
    }
    @RequestMapping("/GrowthStatusCount")
    public Result getGrowthStatusCount(){
        log.info("获取状态统计");
        return Result.success(analyseDataService.getGrowthStatusCount());
    }
    @RequestMapping("/FamilyCount")
    public Result getFamilyCount(){
        log.info("获取科");
        return Result.success(analyseDataService.getFamilyCount());
    }
    @RequestMapping("/GenusCount")
    public Result getGenusCount(){
        log.info("获取属");
        return Result.success(analyseDataService.getGenusCount());
    }
    @RequestMapping("/ChineseNameCount")
    public Result getChineseNameCount(){
        log.info("获取类（中文名）");
        return Result.success(analyseDataService.getChineseNameCount());
    }
}
